package com.example.sql.manager.config;

import com.example.sql.manager.common.ResponseEntity;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * 统一异常处理
 */
@ControllerAdvice
public class ExceptionHandlerConfig {

    @ResponseBody
    @ExceptionHandler(Exception.class)
    public ResponseEntity<String, Object> handleException(Exception e) {
        return ResponseEntity.failure(e.getMessage());
    }

}
